home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Complete_B2071046152007.psc / Bank Management System / button.bas < prev    next >
BASIC Source File  |  2007-04-11  |  6KB  |  168 lines

  1. Attribute VB_Name = "Module1"
  2. 'Module1
  3. Public cnBank As Connection
  4. Public rsCustomers As Recordset
  5. Public rsDeposit As Recordset
  6. Public rsWithdrawal As Recordset
  7. Public rsAccTypes As Recordset
  8.  
  9. Public rsTemp As Recordset
  10. Public rsTemp2 As Recordset
  11.  
  12. Public X As Integer
  13.  
  14. Public Sub create_navigation_buttons(frm As Form)
  15.     With frm
  16.         With .cmdOptions(0)
  17.             .Picture = LoadPicture(App.Path & "\pictures\n1.jpg")
  18.             .DisabledPicture = LoadPicture(App.Path & "\pictures\nd1.jpg")
  19.         End With
  20.         For i = 1 To 4
  21.             Load .cmdOptions(i)
  22.             With .cmdOptions(i)
  23.                 .Visible = True
  24.                 .Left = frm.cmdOptions(i - 1).Left + frm.cmdOptions(i - 1).Width + 25
  25.                 .Picture = LoadPicture(App.Path & "\pictures\n" & (i + 1) & ".jpg")
  26.                 .DisabledPicture = LoadPicture(App.Path & "\pictures\nd" & (i + 1) & ".jpg")
  27.             End With
  28.         Next i
  29.         
  30.         .cmdNavigate(0).Picture = LoadPicture(App.Path & "\pictures\n6.jpg")
  31.         For i = 1 To 3
  32.             Load .cmdNavigate(i)
  33.             With .cmdNavigate(i)
  34.                 .Visible = True
  35.                 .Left = frm.cmdNavigate(i - 1).Left + frm.cmdNavigate(i - 1).Width + 15
  36.                 .Picture = LoadPicture(App.Path & "\pictures\n" & (i + 6) & ".jpg")
  37.             End With
  38.         Next i
  39.         .cmdOptions(1).Enabled = False: .cmdOptions(2).Enabled = False
  40.     End With
  41. End Sub
  42.  
  43. Public Sub create_countries(combobx As ComboBox)
  44.     Dim st() As String
  45.     Dim st2 As String
  46.     Dim i As Integer
  47.     st2 = "United Kingdom\Albania\Argentina\Afghanistan\Algeria\Australia\Belgium\Brazil\China\Canada\Colombia\Costa Rica\Czech Republic\Germany\Denmark\Egypt\Ecuador\United Arab Emirates\Finland\France\Greece\Hong Kong\Hungary\Indonesia\Ireland\India\Israel\Italy\Japan\Lebanon\Malaysia\Mexico\Netherlands\Norway\New Zealand\Austria\Philippines\Pakistan\Poland\Portugal\Peru\Puerto Rico\Russia\Saudi Arabia\Sweden\Spain\Singapore\Switzerland\Thailand\Turkey\Taiwan\Tajikistan\Tanzania\Tunisia\Tuvalu\United States of America\Ukraine\Venezuela\South Africa\Uganda\Uzbekistan\Vatican City\Vietnam\Yemen\Zimbabwe"
  48.     st = Split(st2, "\")
  49.     For i = LBound(st) To UBound(st)
  50.         combobx.AddItem (st(i))
  51.     Next i
  52.     combobx.ListIndex = 25
  53. End Sub
  54.  
  55. Public Sub connectDatabase()
  56.     Set cnBank = New ADODB.Connection
  57.     
  58.     With cnBank
  59.         .Provider = "Microsoft.JET.OLEDB.4.0"
  60.         .ConnectionString = App.Path & "\dbBank.mdb"
  61.         .Open
  62.     End With
  63.     
  64.     Set rsCustomers = New ADODB.Recordset
  65.     rsCustomers.Open "tblCustomers", cnBank, adOpenKeyset, adLockOptimistic
  66.     
  67.     Set rsDeposit = New ADODB.Recordset
  68.     rsDeposit.Open "tblDeposits", cnBank, adOpenKeyset, adLockOptimistic
  69.     
  70.     Set rsWithdrawal = New ADODB.Recordset
  71.     rsWithdrawal.Open "tblWithdrawals", cnBank, adOpenKeyset, adLockOptimistic
  72.     
  73.     Set rsAccTypes = New ADODB.Recordset
  74.     rsAccTypes.Open "tblAccTypes", cnBank, adOpenKeyset, adLockOptimistic
  75.  
  76. End Sub
  77.  
  78. Public Sub clear_Form_Controls(frm As Form)
  79.     Dim ctrl As Control
  80.     For Each ctrl In frm.Controls
  81.         If TypeOf ctrl Is TextBox Then
  82.             ctrl.Text = ""
  83.         ElseIf TypeOf ctrl Is ComboBox Then
  84.             ctrl.Text = ""
  85.         End If
  86.     Next ctrl
  87. End Sub
  88. Public Sub Messager()
  89.     MsgBox "Please Ensure that all fields are Complete", vbExclamation
  90. End Sub
  91. Public Sub Lock_Form_Controls(frm As Form)
  92.     Dim ctrl As Control
  93.     For Each ctrl In frm.Controls
  94.         If TypeOf ctrl Is TextBox Then
  95.             ctrl.Locked = True
  96.         ElseIf TypeOf ctrl Is ComboBox Then
  97.             ctrl.Locked = True
  98.         ElseIf TypeOf ctrl Is DTPicker Then
  99.             ctrl.Enabled = False
  100.         End If
  101.     Next ctrl
  102. End Sub
  103. Public Sub UnLock_Form_Controls(frm As Form)
  104.     Dim ctrl As Control
  105.     For Each ctrl In frm.Controls
  106.         If TypeOf ctrl Is TextBox Then
  107.             ctrl.Locked = False
  108.         ElseIf TypeOf ctrl Is ComboBox Then
  109.             ctrl.Locked = False
  110.         ElseIf TypeOf ctrl Is DTPicker Then
  111.             ctrl.Enabled = True
  112.         End If
  113.     Next ctrl
  114. End Sub
  115. Public Sub MoveToFirst(rsFirst As Recordset)
  116.     With rsFirst
  117.         Call CheckDatabaseStatus(rsFirst)
  118.         .MoveFirst
  119.         If .BOF Then
  120.             .MoveFirst
  121.             MsgBox "This is the first Record..", vbInformation
  122.             Exit Sub
  123.         End If
  124.     End With
  125. End Sub
  126. Public Sub MoveToPrev(rsPrev As Recordset)
  127.     With rsPrev
  128.         Call CheckDatabaseStatus(rsPrev)
  129.         .MovePrevious
  130.         If .BOF Then
  131.             .MoveFirst
  132.             MsgBox "This is the first Record..", vbInformation
  133.             Exit Sub
  134.         End If
  135.     End With
  136. End Sub
  137. Public Sub MoveToNext(rsNext As Recordset)
  138.     With rsNext
  139.         Call CheckDatabaseStatus(rsNext)
  140.         .MoveNext
  141.         If .EOF Then
  142.             .MoveLast
  143.             MsgBox "This is the last Record..", vbInformation
  144.             Exit Sub
  145.         End If
  146.     End With
  147. End Sub
  148.  
  149. Public Sub MoveToLast(rsLast As Recordset)
  150.     With rsLast
  151.         Call CheckDatabaseStatus(rsLast)
  152.         .MoveLast
  153.         If .EOF Then
  154.             .MoveLast
  155.             MsgBox "This is the last Record..", vbInformation
  156.             Exit Sub
  157.         End If
  158.     End With
  159. End Sub
  160. Public Sub CheckDatabaseStatus(rsStat As Recordset)
  161.     With rsStat
  162.         If .BOF = True And .EOF = True Then
  163.             MsgBox "There are currently No records Available for this module", vbInformation
  164.             Exit Sub
  165.         End If
  166.     End With
  167. End Sub
  168.